home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
usr
/
sbin
/
opengl-update
< prev
next >
Wrap
Text File
|
2006-04-12
|
4KB
|
168 lines
#!/bin/bash
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-base/opengl-update/files/opengl-update-3.0.0,v 1.4 2005/08/17 21:51:02 eradicator Exp $
# Author: Martin Schlemmer <azarah@gentoo.org>
# Further modifications by Donnie Berkholz <spyderous@gentoo.org>
# Further modifications based off submissions to bug #54984 <cyfred@gentoo.org>
# Further modifications by Jeremy Huddleston <eradicator@gentoo.org>
. /etc/init.d/functions.sh
hasq() {
local x
local me=${1}
shift
for x in "${@}"; do
if [[ "${x}" == "${me}" ]]; then
return 0
fi
done
return 1
}
print_usage() {
cat << FOO
Usage: ${0##*/} [<options>] <GL implementation>
Set the opengl implementation.
Valid options:
--use-old: If an implementation is already set, use that one.
--prefix=<val>: Set the source prefix (default: /usr)
--dst-prefix=<val>: Set the destination prefix (default: /usr)
--impl-headers: Use headers provided by this implementation to
override golbal ones provided by opengl-update.
Usage: ${0##*/} --get-implementation
Print the current implementaion
Notes:
--impl-headers was default in <opengl-update-2.2.
Examples:
${0##*/} xorg-x11
This will setup things to use libGL.so from X.org.
${0##*/} nvidia
This will setup things to use libGL.so from the nVidia drivers.
WARNING: opengl-update is deprecated and is just a frontend to the opengl
eselect module. In the future, opengl-update will be removed
from portage. Please see 'eselect opengl help'
FOO
}
get_implementations() {
local implems
for dir in ${PREFIX}/lib{,32,64}/opengl/*; do
if [[ -d "${dir}" && ${dir##*/} != "global" ]] && ! hasq ${dir##*/} ${implems}; then
implems=${implems:+${implems} }${dir##*/}
fi
done
echo ${implems}
}
parse_options() {
local opt
while [[ ${#} -gt 0 ]]; do
opt=${1}
shift
case ${opt} in
--use-old)
if [[ -n "${ACTION}" ]]; then
ACTION="error"
eerror "Invalid usage."
else
if [[ -n "${CURRENT_GL_IMPLEM}" ]] && hasq ${CURRENT_GL_IMPLEM} ${AVAIL_IMPLEMS}; then
ACTION="old-implementation"
fi
fi
;;
--get-implementation)
if [[ -n "${ACTION}" ]]; then
ACTION="error"
eerror "Invalid usage."
else
ACTION="get-implementation"
fi
;;
--prefix=*)
PREFIX=${opt#*=}
AVAIL_IMPLEMS=$(get_implementations)
;;
--dst-prefix=*)
DST_PREFIX=${opt#*=}
;;
--impl-headers)
USE_PROFILE_HEADERS="yes"
;;
--help|-h|-?)
ACION="usage"
;;
*)
if hasq ${opt} ${AVAIL_IMPLEMS}; then
if [[ "${ACTION}" != "old-implementation" ]]; then
if [[ -n "${ACTION}" ]]; then
ACTION="error"
eerror "Invalid usage."
else
ACTION="set-implementation"
NEW_GL_IMPLEM="${opt}"
fi
fi
else
eerror "Unrecognized option: ${opt}"
ACTION="error"
fi
;;
esac
done
}
## START PROGRAM ##
NEW_GL_IMPLEM=""
ACTION=""
PREFIX="/usr"
DST_PREFIX="/usr"
AVAIL_IMPLEMS=$(get_implementations)
CURRENT_GL_IMPLEM=$(eselect opengl show)
USE_PROFILE_HEADERS="no"
parse_options ${@}
case ${ACTION} in
get-implementation)
eselect opengl show
;;
old-implementation)
ewarn "opengl-update is deprecated and is just a frontend to the opengl"
ewarn "eselect module. In the future, opengl-update will be removed"
ewarn "from portage. Please see 'eselect opengl help'"
eselect opengl set --use-old
exit $?
;;
set-implementation)
ewarn "opengl-update is deprecated and is just a frontend to the opengl"
ewarn "eselect module. In the future, opengl-update will be removed"
ewarn "from portage. Please see 'eselect opengl help'"
if [[ ${USE_PROFILE_HEADERS} == "yes" ]] ; then
eselect opengl set ${NEW_GL_IMPLEM} --prefix="${PREFIX}" --dst-prefix="${DST_PREFIX}" --impl-headers
else
eselect opengl set ${NEW_GL_IMPLEM} --prefix="${PREFIX}" --dst-prefix="${DST_PREFIX}"
fi
;;
usage)
print_usage
exit 0
;;
*)
print_usage
exit 1
;;
esac